package com.coolrui.model;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @NotEmpty 校验集合
 * @NotBlank 校验String类型(不能校验Integer)
 * @NotNull 校验基本类型
 */
@Data
public class UserCreateRequest {
    @NotBlank(message = "姓名不能为空")
    @Length(min=2, max=8, message="姓名长度为2到8位")
    private String name;

    @NotNull(message = "性别不能为空")
    @Min(value=1, message = "性别只能是1或2，1男2女")
    @Max(value = 2, message = "性别只能是1或2，1男2女")
    private Integer sex;

    @NotNull(message = "年龄不能为空")
    @Min(value=20, message = "年龄不能小于20")
    @Max(value = 60, message = "年龄不能大于60")
    private Integer age;

    @NotBlank(message = "住址不能为空")
    private String address;

    @NotBlank(message = "手机号码不能为空")
    private String mobile;
}
